package com.example.text_textfield;

import ohos.aafwk.ability.Ability;
import ohos.aafwk.content.Intent;
import ohos.aafwk.content.Operation;
import ohos.agp.components.Component;

public class MainAbility extends Ability {
    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        super.setUIContent(ResourceTable.Layout_ability_main);
        findComponentById(ResourceTable.Id_text_option)
                .setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component component) {
                Intent intent1 = new Intent();
                Operation operation = new Intent.OperationBuilder()
                        .withAction("")
                        .withBundleName(getBundleName())
                        .withAbilityName(TextAbility.class.getName())
                        .build();
                intent1.setOperation(operation);
                startAbility(intent1);
            }
        });

        findComponentById(ResourceTable.Id_textField_option)
                .setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component component) {
                Intent intent1 = new Intent();
                Operation operation = new Intent.OperationBuilder()
                        .withAction("")
                        .withBundleName(getBundleName())
                        .withAbilityName(TextFieldAbility.class.getName())
                        .build();
                intent1.setOperation(operation);
                startAbility(intent1);
            }
        });
    }
}
